<include file="Public/head" />
<style type="text/css">
  .head-order-tips{float: right;position: relative;cursor:pointer;}
  .icon-bell-o:before {font-size: 40px;color:#fff;}
  .number{width:25px;height:25px;color:#fff;padding: 3px;background: #f96666;position: absolute;top:-8px;border-radius: 50%;right: -8px;text-align: center;}
</style>
<body style="background-color:#f2f9fd;">

  <div class="header bg-main">
    <div class="logo margin-big-left fadein-top">
      <h1>
        <empty name="company['company_logo']">
          <img src="__PUBLIC__/images/zanwu.jpg" class="radius-circle rotate-hover" height="50" />
          <else />
          <img src="__ROOT__/{$company['company_logo']}" class="radius-circle rotate-hover" height="50" />
        </empty>
        {$company['company_name']}
      </h1>
    </div>

    <div class="head-l" style="float: right; margin-right: 50px;">
        <select name="s_id" id="sel"  onchange="ccc(this.value)" style="width: 150px;border: solid 1px #ddd;border-radius: 3px;line-height: 20px;height: 33px; ">
            <option>请选择门店</option>
            <foreach name="data" item="v">
                <option value="{$v['s_id']}" <if condition="$v['s_id'] eq $selectedStore">selected="selected"</if>>{$v['store_name']}</option>
            </foreach>
        </select>
      <a class="button button-little bg-red" href="{:U('Login/logout')}">
            <span class="icon-power-off"></span> {:L("logout")}
      </a>
    </div>
    <!-- 铃铛 -->
    <a id="nav" href="{:U('Order/index')}" target="right">
    <div class="head-l head-order-tips tips" onclick="see()"  data-toggle="hover" data-place="left" title="新的订单">
      <span class="icon-bell-o"></span>
      <div id="number" style="display: none;" class="number"></div>
    </div>
    </a>
    <!-- 铃铛 end-->
  </div>
  <div class="leftnav">
    <div class="leftnav-title"><strong><span class="icon-list"></span>{:L("caidanliebiao")}</strong></div>
      <volist name="topAuth" id="top">
    <h2><span class="icon-star"></span>{$top.auth_name}</h2>
    <ul style="display:none">
        <volist name="sonAuth" id="son">
            <if condition="$son[auth_pid] eq $top[auth_id]">
                <li>
                    <cite></cite><a href="{:U($son['auth_controller'].'/'.$son['auth_action'])}" target="right"><span class="icon-caret-right"></span>{$son.auth_name}</a>
                </li>
            </if>
        </volist>
    </ul>
       </volist>
  </div>

  <script type="text/javascript">
    $(function(){
      $(".leftnav h2").click(function(){
       $(this).next().slideToggle(200);	
       $(this).toggleClass("on");
     })
      $(".leftnav ul li a").click(function(){
       $("#a_leader_txt").text($(this).text());
       $(".leftnav ul li a").removeClass("on");
       $(this).addClass("on");
     })

    });

  </script>

  <ul class="bread">

    <li><a href="{:U('Goods/index')}" target="right" class="icon-home"> {:L("home")}</a></li>

    <li><a href="#" id="a_leader_txt">管理门店</a></li>

    <!--<li style="float: right;"><b>{:L("languager")}：</b><a href="?l=zh-cn">{:L("chinese")}</a> | <a href="?l=en-us">{:L("english")}</a></li>-->

  </ul>

  <div class="admin">

    <iframe scrolling="auto" rameborder="0" src="{:U('goods/index')}" name="right" width="100%" height="100%"></iframe>

  </div>
<video id="video1" style="display: none;">
  <source src="__PUBLIC__/speech/tips.mp3" type="video/mp4">
</video>
</body>

<script>

    function ccc(s_id){

        var url = "{:U('index/sel')}";

        $.getJSON(url,{s_id:s_id},function (data){

            if(data.result == 'tp1'){

                window.location.href = "{:U('index/index')}";

            }

        })

    }

var myVideo = document.getElementById("video1");
var number = document.getElementById("number");
var nav = document.getElementById("nav");
var newOrder = {};
var url = "{:U('order/index')}";
setInterval("checkNewOredre()",10000);
//查找新订单
function checkNewOredre(){
  $.getJSON("{:U('index/checkNewOredre')}",{},function (data){
    if(data.status == 0){
      number.innerHTML = data.data.length;
      number.style.display = 'block';
      newOrder = data.data;
      nav.href = url + '?order_list=' + newOrder.join(",");
      myVideo.play();
    }else{
      number.style.display = 'none';
    }
  })
}
//告诉系统已经看了
function see(){
  console.log(newOrder,'newOrder');
  if(newOrder.length > 0){
    $.post("{:U('index/setOldOrder')}")
    number.innerHTML = 0;
    number.style.display = 'none';
  }
}
</script>

</html>